package com.example.dao;

import com.example.entity.Branches;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
public class TestDao {

    @Autowired
    CityAreaDao cityAreaDao;

    @Autowired
    BranchesDao branchesDao;

    @Test
    void test1(){
        System.out.println(cityAreaDao.getAll());
    }

    @Test
    void test2(){
        System.out.println(branchesDao.getOne(1));
    }
    @Test
    void test3(){
        System.out.println(branchesDao.getAll());
    }
    @Test
    void test4(){
        branchesDao.add(Branches.builder().name("网点1").cityAreaId(1)
                .telephone("9987").address("海珠").build());
    }

    @Test
    void test5(){
        branchesDao.delete(6);
    }

    @Test
    void test6(){
        Branches branches = this.branchesDao.getOne(1);
        branches.setTelephone("123321");
        this.branchesDao.update(branches);
    }
}
